package com.catering.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.catering.entity.CateringCart;
import com.catering.entity.CateringIntegral;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CateringIntegralDao extends BaseMapper<CateringIntegral> {

    @Select("select t1.*,t2.order_no,t3.user_name,t3.nick_name from catering_integral t1 left join catering_order t2 on t2.sys_id = t1.order_id left join catering_user t3 on t1.user_id = t3.user_id ${ew.customSqlSegment}")
    public IPage<CateringIntegral> selectPageList(IPage<CateringIntegral> page, @Param(Constants.WRAPPER) QueryWrapper<CateringCart> queryWrapper);

    @Select("select count(1) from catering_integral t1 left join catering_order t2 on t2.sys_id = t1.order_id left join catering_user t3 on t1.user_id = t3.user_id ${ew.customSqlSegment}")
    public int selectPageCount(@Param(Constants.WRAPPER) QueryWrapper<CateringIntegral> queryWrapper);

    @Select("select t1.*,t2.order_no,t3.user_name,t3.nick_name from catering_integral t1 left join catering_order t2 on t2.sys_id = t1.order_id left join catering_user t3 on t1.user_id = t3.user_id ${ew.customSqlSegment}")
    public List<CateringIntegral> selectNoPageList(@Param(Constants.WRAPPER) QueryWrapper<CateringIntegral> queryWrapper);
}
